//
//  DYCardListCell.m
//  PrivatePhoto
//
//  Created by PrivatePhoto Team on 2021.
//  Copyright © 2021年 PrivatePhoto Team. All rights reserved.
//

#import "DYCardListCell.h"
//#import "CLRollLabel.h"
@interface DYCardListCell ()

//@property (nonatomic, strong) UIImageView *logoIcon;
//@property (nonatomic, strong) UILabel *nameLabel;
//@property (nonatomic, strong) CLRollLabel *detailLabel;

@end

@implementation DYCardListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
       
        [self configSubView];
    }
    return self;
}


-(void)setFrame:(CGRect)frame
{
    frame.origin.x = 15;//这里间距为10，可以根据自己的情况调整
    frame.size.width -= 2 * frame.origin.x;
    frame.size.height -= 2 * 8;
    [super setFrame:frame];
  
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.layer.masksToBounds = YES;
    self.layer.cornerRadius = 15.0;
    [self.logoIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(15);
        make.left.mas_offset(15);
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.logoIcon.mas_bottom).mas_offset(25);
        make.left.mas_offset(15);
    }];
    
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.nameLabel.mas_bottom).mas_offset(10);
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.height.mas_equalTo(20);
    }];
    
}

- (void)configSubView{

    [self.contentView addSubview:self.detailLabel];
  
    [self.contentView addSubview:self.nameLabel];
  
    [self.contentView addSubview:self.logoIcon];
   
    
}

#pragma mark --setter/getter

- (UIImageView *)logoIcon{
    if (!_logoIcon) {
        _logoIcon = [[UIImageView alloc] init];
    }
    return _logoIcon;
}

- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.font = [UIFont systemFontOfSize:20 weight:5];
        _nameLabel.textColor = [UIColor whiteColor];
    }
    return _nameLabel;
}

- (CLRollLabel *)detailLabel{
    if (!_detailLabel) {
        CGRect frame = CGRectMake(10, self.frame.size.height - 30, self.frame.size.width-20, 20);
        _detailLabel = [[CLRollLabel alloc] initWithFrame:frame font:[UIFont systemFontOfSize:17] textColor:[UIColor whiteColor]];
        _detailLabel.text = @"今后贼界差人齎到文字，如依前僭伪，立便发遣出界，不得收接。今后贼界差人齎到文字，如依前僭伪，立便发遣出界，不得收接。";
    }
    return _detailLabel;
}

@end
